package com.industrial.premu.service.impl;

import java.util.Date;
import java.util.List;

import com.industrial.common.core.utils.uuid.IdUtils;
import com.industrial.common.security.utils.SecurityUtils;
import com.industrial.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.industrial.premu.mapper.PreMuCompilationMapper;
import com.industrial.premu.domain.PreMuCompilation;
import com.industrial.premu.service.IPreMuCompilationService;

/**
 * 考核汇编材料Service业务层处理
 * 
 * @author ZHOU_S
 * @date 2024-01-22
 */
@Service
public class PreMuCompilationServiceImpl implements IPreMuCompilationService 
{
    @Autowired
    private PreMuCompilationMapper preMuCompilationMapper;

    /**
     * 查询考核汇编材料
     * 
     * @param baseId 考核汇编材料主键
     * @return 考核汇编材料
     */
    @Override
    public PreMuCompilation selectPreMuCompilationByBaseId(String baseId)
    {
        return preMuCompilationMapper.selectPreMuCompilationByBaseId(baseId);
    }

    /**
     * 查询考核汇编材料列表
     * 
     * @param preMuCompilation 考核汇编材料
     * @return 考核汇编材料
     */
    @Override
    public List<PreMuCompilation> selectPreMuCompilationList(PreMuCompilation preMuCompilation)
    {
        return preMuCompilationMapper.selectPreMuCompilationList(preMuCompilation);
    }

    /**
     * 新增考核汇编材料
     * 
     * @param preMuCompilation 考核汇编材料
     * @return 结果
     */
    @Override
    public int insertPreMuCompilation(PreMuCompilation preMuCompilation)
    {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        preMuCompilation.setBaseId(IdUtils.simpleUUID());
        preMuCompilation.setBaseCreateTime(new Date());
        preMuCompilation.setCreator(loginUser.getUserid());
        return preMuCompilationMapper.insertPreMuCompilation(preMuCompilation);
    }

    /**
     * 修改考核汇编材料
     * 
     * @param preMuCompilation 考核汇编材料
     * @return 结果
     */
    @Override
    public int updatePreMuCompilation(PreMuCompilation preMuCompilation)
    {
        return preMuCompilationMapper.updatePreMuCompilation(preMuCompilation);
    }

    /**
     * 批量删除考核汇编材料
     * 
     * @param baseIds 需要删除的考核汇编材料主键
     * @return 结果
     */
    @Override
    public int deletePreMuCompilationByBaseIds(String[] baseIds)
    {
        return preMuCompilationMapper.deletePreMuCompilationByBaseIds(baseIds);
    }

    /**
     * 删除考核汇编材料信息
     * 
     * @param baseId 考核汇编材料主键
     * @return 结果
     */
    @Override
    public int deletePreMuCompilationByBaseId(String baseId)
    {
        return preMuCompilationMapper.deletePreMuCompilationByBaseId(baseId);
    }
}
